<script type="text/javascript">
	$(function () {
			var data_type = '{{$data_type}}';
			var data_id = '{{$data_id}}';

            $.ajax({
                url : '/admin/application/apppage_rectpls/datas/'+data_type+'/resources',
                type:'get',
                dataType:'json',
                cache: false,
                async:true,
                success:function(data){
                    if (data.status) {
                        $(".data_id").empty();// jq写法 清楚地区下拉框的所有内容，然后拼接上从后台取出来的数据
                        $("<option value=''>请选择</option>").appendTo(".data_id");
                        var reasourceData = data.content;
                        // console.log(reasourceData.length);
                        for(var i=0;i<reasourceData.length;i++){//获取reasourceData里面的数据，拼接到select上
                            if (reasourceData[i].id == data_id) {
                                $(".data_id").append("<option value='"+reasourceData[i].id+"' selected >"+reasourceData[i].title+"</option>");

                            }else{
                                $(".data_id").append("<option value='"+reasourceData[i].id+"'>"+reasourceData[i].title+"</option>");
                            }
                        }
                    } else {
                        // layer.msg(data.content, {
                        //     icon: 5
                        // });
                    }

                },
                error: function() {
                    layer.msg("异常！");
                }
            });
        });

</script>
